home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1997 January / macformat46.iso / Shareware Plus / Developers / Library / Grant's CGI Framework / Grant's CGI Framework / grantscgi / Util / DebugUtil.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-09-20  |  1.3 KB  |  57 lines

  1. /*****
  2.  *
  3.  *    DebugUtil.c
  4.  *
  5.  *    For those of you unfamilliar with assertions, run - don't walk -
  6.  *    to get a copy of "Code Complete" by Steve McDonnell(sp?)
  7.  *
  8.  *    This is a support file for "Grant's CGI Framework".
  9.  *    Please see the license agreement that accompanies the distribution package
  10.  *    for licensing details.
  11.  *
  12.  *    Copyright ©1995,1996 by Grant Neufeld
  13.  *    grant@acm.com
  14.  *    http://arpp.carleton.ca/cgi/framework/
  15.  *
  16.  *****/
  17.  
  18. #include <ConditionalMacros.h>
  19.  
  20. #include "MyConfiguration.h"
  21.  
  22.  
  23. #include "LogUtil.h"
  24.  
  25. #include "DebugUtil.h"
  26.  
  27.  
  28. /***  FUNCTIONS  ***/
  29.  
  30. /* if the assertion (passed) fails, display the string in the debugger to alert
  31.     the developer to an unexpected problem in the code.
  32.     theString must be a Pascal format string (IE. "\p").
  33.     If an assertion ever occurs, you know that one of two things has occurred:
  34.     - something you never expected to happen in your function, happened
  35.     - you made an incorrect assumption about what state things could be in
  36.         prior to your function being called */
  37. #if kCompileWithAssertions
  38. p_export
  39. void
  40. my_assert ( Boolean passed, const StringPtr theString )
  41. {
  42.     if ( !passed )
  43.     {
  44.         LogStringDebugP ( theString );
  45.         
  46.         #if GENERATINGPOWERPC
  47.         DebugStr ( theString );
  48.         #else
  49.         SysBreakStr ( theString );
  50.         #endif
  51.     }
  52. } /* my_assert */
  53. #endif
  54.  
  55.  
  56. /***  EOF  ***/
  57.